function sum(numbers, callBack) {
    var temp = 0;
    numbers.forEach(function (i) {
        if (callBack(i)) {
            temp += i;
        }
    });
    return temp;
}
var result = sum([1, 4, 3, 5, 22, 3, 4, 7, 2], function (n) { return n % 2 !== 0; });
console.log(result);
